package com.iot.manage.service;

import com.alibaba.fastjson.JSONObject;
import com.iot.manage.dao.DeviceEventMapper;
import com.iot.manage.pojo.DeviceEvent;
import com.iot.manage.pojo.SysCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceEventService {

    @Autowired
    private DeviceEventMapper deviceEventMapper;

    public List<DeviceEvent> findDEventList(String query, int pagenum, int pagesize) {
        return deviceEventMapper.findDEventList(query,pagesize * (pagenum - 1),pagesize * pagenum);
    }

    public int countDEventList(String query) {
        return deviceEventMapper.countDEventList(query);
    }

    public void addDEventInfo(JSONObject params) {
        deviceEventMapper.addDEventInfo(params);
    }

    public DeviceEvent findDEventInfoByIdOrCode(String params) {
        return deviceEventMapper.findDEventInfoByIdOrCode(params);
    }

    public void updateDEventInfo(JSONObject params) {
        deviceEventMapper.updateDEventInfo(params);
    }

    public void deleteDEventInfo(String deventId) {
        deviceEventMapper.deleteDEventInfo(deventId);
    }

    public List<SysCode> findDEventTypeList() {
        return deviceEventMapper.findDEventTypeList();
    }

    public int countEventUseTotal(String deventCode) {
        return deviceEventMapper.countEventUseTotal(deventCode);
    }

    public void updateDeviceModelArg(JSONObject params) {
        deviceEventMapper.updateDeviceModelArg(params);
    }
}
